using System;
using System.Data;
using System.Collections.Generic;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MeetingRoom.Domain;
using MeetingRoom;
using MeetingRoom.Data;
using MeetingRoom.Data.Implementation;
using MeetingRoom.Service;
using MeetingRoom.Service.Implementation;

public partial class _Default : System.Web.UI.Page
{
    protected SimpleScheduleDataQuery scheduleQuery = null;

    public _Default()
    {

    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!base.IsPostBack)
        {
            welcomeLabel.Visible = true;
        }
        else
        {
            this.error.Visible = false;
        }
    }

    protected void submit_Click(object sender, EventArgs e)
    {
        string userName = this.accountTextBox.Text;
        string password = this.passwordTextBox.Text;

        if (Membership.ValidateUser(userName, password))
        {
            FormsAuthentication.RedirectFromLoginPage(userName, false);
        }
        else
        {
            this.error.Visible = true;
        }
        return;

        Staff staff = null;
        Session["account"] = staff;
        if (staff == null)
        {
            Response.Redirect("forget.aspx");
        }
        else
        {
            Response.Redirect("Welcome.aspx");
        }
    }

    protected void search_Click(object sender, EventArgs e)
    {
        List<Schedule> allSchedules = SimpleScheduleDataQuery.GetSchedules();
        Session["schedules"] = allSchedules;
        Response.Redirect("ShowSessions.aspx");
    }

    protected void Register_Click(object sender, EventArgs e)
    {
        Response.Redirect("Register.aspx");
    }

    protected void apply_Click(object sender, EventArgs e)
    {
        Response.Redirect("Apply.aspx");
    }
}